Skip to content

Fix Clang 22 warnings part 2#7309

Closed
KonstaT wants to merge 1 commit intoraspberrypi:rpi-6.18.yfrom
KonstaT:rpi-6.18.y-clang2
Closed

Fix Clang 22 warnings part 2#7309
KonstaT wants to merge 1 commit intoraspberrypi:rpi-6.18.yfrom
KonstaT:rpi-6.18.y-clang2

Conversation

@KonstaT
Copy link
Copy Markdown

@KonstaT KonstaT commented Apr 9, 2026

Split one patch from #7299.

* Fixes build with Clang.

In file included from drivers/pwm/pwm-pio-rp1.c:20:
include/linux/pio_rp1.h:283:42: error: implicit conversion from 'uint' (aka 'unsigned int') to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Werror,-Wconstant-conversion]
  283 |         args.origin = (program->origin == -1) ? PIO_ORIGIN_ANY : program->origin;
      |                     ~                           ^~~~~~~~~~~~~~
include/linux/pio_rp1.h:44:27: note: expanded from macro 'PIO_ORIGIN_ANY'
   44 | #define PIO_ORIGIN_ANY                  ((uint)(~0))
      |                                          ^~~~~~~~~~
include/linux/pio_rp1.h:312:42: error: implicit conversion from 'uint' (aka 'unsigned int') to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Werror,-Wconstant-conversion]
  312 |         args.origin = (program->origin == -1) ? PIO_ORIGIN_ANY : program->origin;
      |                     ~                           ^~~~~~~~~~~~~~
include/linux/pio_rp1.h:44:27: note: expanded from macro 'PIO_ORIGIN_ANY'
   44 | #define PIO_ORIGIN_ANY                  ((uint)(~0))
      |                                          ^~~~~~~~~~
2 errors generated.
@KonstaT KonstaT mentioned this pull request Apr 9, 2026
pelwell added a commit that referenced this pull request Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts.

See: #7309

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented Apr 10, 2026

See #7311 for an alternative fix. I didn't want to change the define because the error value is part of the ABI.

@KonstaT
Copy link
Copy Markdown
Author

KonstaT commented Apr 10, 2026

Yeah, #7311 works for me with Clang 22 so I'll close this one.

@KonstaT KonstaT closed this Apr 10, 2026
pelwell added a commit that referenced this pull request Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts.

See: #7309

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented Apr 10, 2026

Thanks!

pelwell added a commit that referenced this pull request Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts.

See: #7309

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell added a commit that referenced this pull request Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts.

See: #7309

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pelwell added a commit that referenced this pull request Apr 10, 2026
Avoid some compiler warnings by adding explicit narrowing casts.

See: #7309

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants